import { Pipe, PipeTransform } from '@angular/core';

@Pipe({ name: 'ToTime' })
export class ToTimePipe implements PipeTransform {
  transform(value: any): string {
    var time = new Date(value.replace(/-/g,'/'));
    if (!value) return;
    let year = time.getFullYear();
    let month = (time.getMonth() + 1).toString();
    let day = (time.getDate()).toString();

    if (month.length == 1) month = "0" + month;
    if (day.length == 1) day = "0" + day;

    let dateTime = "";
    dateTime = `${year}.${month}.${day}`;
    return dateTime;
  }
}